/**
 * Created by jiangtao on 16/6/17.
 */
define(function(require, exports, module) {
    require("LIBS/iscroll/iscroll-probe.js");
    var me = {
        layout:require("TEMPLATE/common/layout.tpl"),
        element: document.getElementById('app'),
        template: require("TEMPLATE/teacher/index.tpl"),
        VM:null,
        scroll:null,
        init: function(){
            var use = ["render","run"];
            use.forEach(function(name){
               for(var key in this) {
                  if(key == name) {
                      this[key]();
                  };
               };
            }.bind(this));
        },
        render: function(){
           this.VM = layout(this.element,{
                layout:this.layout,
                template:this.template
           });
           this.scroll = Pagination("#scroll_el",function(d,iscroll,to){
                console.log(to);
           });
        },
        run: function(){
            var vm   = this.VM,
                self = this;
            //监听数据变化
            vm.$watch('activeList.data',function(){
                 self.scroll.refresh();
            });
            vm.handel.text = '成为导师';
            var mock =  [{
                name:"文静",
                age:23,
                industy:"移动互联网",
                company:"成都阿商信息技术有限公司",
                position:"web前端",
                image: "http://img.small.hudongba.com/upload/_oss/userhead/yuantu/201607/1114/zz0n11468218745480.jpg@!user-head",
                skills:[{index:1,text:"行业知识"}],
                link:staticUrl + '/views/index.html?entery=teacher/teacherDetail&id=1'
            },{
                name:"张倩",
                age:23,
                industy:"计算机硬件",
                company:"成都阿商信息技术有限公司",
                position:"web前端",
                image: "http://img.small.hudongba.com/upload/_cos/userhead/yuantu/201509/1113/rjavo1441948171331.jpg@!user-head",
                skills:[{index:1,text:"行业知识"},{index:2,text:"简历制作"}, {index:3,text:"面试技巧"}],
                link:staticUrl + '/views/index.html?entery=teacher/teacherDetail&id=1'
            },{
                name:"刘红",
                age:23,
                industy:"计算机硬件",
                company:"成都阿商信息技术有限公司",
                position:"web前端",
                image: "http://img.small.hudongba.com/upload/_oss/userhead/yuantu/201603/0815/5gpf41457420531953.jpg@!user-head",
                skills:[{index:1,text:"行业知识"},{index:2,text:"简历制作"}, {index:3,text:"面试技巧"}],
                link:staticUrl + '/views/index.html?entery=teacher/teacherDetail&id=1'
            },{
                name:"张军",
                age:23,
                industy:"计算机硬件",
                company:"成都阿商信息技术有限公司",
                position:"web前端",
                image: "http://img.small.hudongba.com/upload/_oss/userhead/yuantu/201607/1113/uzs211468215944620.jpg@!user-head",
                skills:[{index:1,text:"行业知识"},{index:2,text:"简历制作"}, {index:3,text:"面试技巧"}],
                link:staticUrl + '/views/index.html?entery=teacher/teacherDetail&id=1'
            }, {
                name:"牛云",
                age:23,
                industy:"计算机硬件",
                company:"成都阿商信息技术有限公司",
                position:"web前端",
                image: "http://img.small.hudongba.com/upload/_oss/userhead/yuantu/201607/0814/ba5u11467958369232.jpg@!user-head",
                skills:[{index:1,text:"行业知识"},{index:2,text:"简历制作"}, {index:3,text:"面试技巧"}],
                link:staticUrl + '/views/index.html?entery=teacher/teacherDetail&id=1'
            },{
                name:"文静",
                age:23,
                industy:"移动互联网",
                company:"成都阿商信息技术有限公司",
                position:"web前端",
                image: "http://img.small.hudongba.com/upload/_oss/userhead/yuantu/201607/1114/zz0n11468218745480.jpg@!user-head",
                skills:[{index:1,text:"行业知识"}],
                link:staticUrl + '/views/index.html?entery=teacher/teacherDetail&id=1'
            },{
                name:"张倩",
                age:23,
                industy:"计算机硬件",
                company:"成都阿商信息技术有限公司",
                position:"web前端",
                image: "http://img.small.hudongba.com/upload/_cos/userhead/yuantu/201509/1113/rjavo1441948171331.jpg@!user-head",
                skills:[{index:1,text:"行业知识"},{index:2,text:"简历制作"}, {index:3,text:"面试技巧"}],
                link:staticUrl + '/views/index.html?entery=teacher/teacherDetail&id=1'
            },{
                name:"刘红",
                age:23,
                industy:"计算机硬件",
                company:"成都阿商信息技术有限公司",
                position:"web前端",
                image: "http://img.small.hudongba.com/upload/_oss/userhead/yuantu/201603/0815/5gpf41457420531953.jpg@!user-head",
                skills:[{index:1,text:"行业知识"},{index:2,text:"简历制作"}, {index:3,text:"面试技巧"}],
                link:staticUrl + '/views/index.html?entery=teacher/teacherDetail&id=1'
            },{
                name:"张军",
                age:23,
                industy:"计算机硬件",
                company:"成都阿商信息技术有限公司",
                position:"web前端",
                image: "http://img.small.hudongba.com/upload/_oss/userhead/yuantu/201607/1113/uzs211468215944620.jpg@!user-head",
                skills:[{index:1,text:"行业知识"},{index:2,text:"简历制作"}, {index:3,text:"面试技巧"}],
                link:staticUrl + '/views/index.html?entery=teacher/teacherDetail&id=1'
            }, {
                name:"牛云",
                age:23,
                industy:"计算机硬件",
                company:"成都阿商信息技术有限公司",
                position:"web前端",
                image: "http://img.small.hudongba.com/upload/_oss/userhead/yuantu/201607/0814/ba5u11467958369232.jpg@!user-head",
                skills:[{index:1,text:"行业知识"},{index:2,text:"简历制作"}, {index:3,text:"面试技巧"}],
                link:staticUrl + '/views/index.html?entery=teacher/teacherDetail&id=1'
            }];
            var tableData = [
                {name:'定制辅导',data:mock,url:staticUrl +'/views/index.html?entery=teacher/index'},
                {name:'精品课程',data:[],url:staticUrl+'/views/index.html?entery=activity/list'},
                {name:'优质岗位',data:[],url:staticUrl + '/views/index.html?entery=position/position'}
            ];

            vm.nav = tableData;
            vm.nav[0].active = true;
            vm.activeList.data = tableData[0].data;
        }
    };
    me.init();
});